import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
const model = new THREE.Group();

const loader = new GLTFLoader();
loader.load("/上海外滩.glb", function (gltf) { //gltf加载成功后返回一个对象
    // console.log('控制台查看gltf对象结构', gltf);
    //把gltf.scene中的所有模型添加到model组对象中
    model.add(gltf.scene);
    // 东方明珠
    const dfmz =  gltf.scene.getObjectByName("东方明珠")
    dfmz.material = new THREE.MeshLambertMaterial({
      color:0x996633
    })
    // 设置地面材质
    var Floor = gltf.scene.getObjectByName('地面');
    Floor.material = new THREE.MeshLambertMaterial({
      color: 0x444433,
    });
     // 设置河面材质
    var River = gltf.scene.getObjectByName('河面');
    River.material = new THREE.MeshLambertMaterial({
      color: 0x336633,
    });
  })
export {model};